home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / LaZaRuS XXI.txt < prev    next >
Encoding:
Text File  |  1999-07-04  |  8.3 KB  |  176 lines

  1.  
  2.  
  3.                      L                ZZZZZZ         RRRRR           SSSSS
  4.                      L                    Z          R    R         S
  5.                      L          aaa      Z      aaa  R    R  u   u  S
  6.                      L            a     Z         a  RRRRR   u   u  SSSSS
  7.                XX    L         aaaa    Z       aaaa  R    R  u   u       S
  8.               XXXX   L        a   a   Z       a   a  R    R  u   u       S
  9.              XXXXXX  LLLLLLL  aaaaa  ZZZZZZZ  aaaaa  R    R  uuuuu  SSSSSS
  10.              XXXXXX       
  11.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  12.        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  13.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  14.              XXXXXX
  15.              XXXXXX
  16.               XXXX        proudly presents his 21.Cracking Tutorial (04.07.1999)
  17.                XX                       Cruehead's CrackMe 3.0
  18.  
  19. I.    Introduction
  20. I.1   Tools you need for my tutorial
  21. II.   The Crack
  22. VI.   BTW
  23. VII.  All Tutorials by LaZaRuS
  24.  
  25. I.   Welcome to my 21st cracking tutorial.
  26.      This time I will describe my first Keyfile crack :) Though it was quite easy, I am still
  27.      happy about it :)))
  28.  
  29. I.1  W32Dasm 8.9
  30.      Cruehead's CrackMe 3.0
  31.  
  32. II.  The crack
  33.      When you disassemble (Sorry, Crue - I still have no SICE here) you will easily see a
  34.      string that looks like a filename for a keyfile: Crackme3.key - Luckily this is really the
  35.      correct keyfile name.
  36.      So let's start - You should see this:
  37.  
  38.      :00401021 6A03                    push 00000003
  39.      :00401023 68000000C0              push C0000000
  40.  
  41.      * Possible StringData Ref from Data Obj ->"CRACKME3.KEY"
  42.                                        |
  43.      :00401028 68D7204000              push 004020D7
  44.  
  45.      * Reference To: KERNEL32.CreateFileA, Ord:0000h
  46.                                        |
  47.      :0040102D E876040000              Call 004014A8   ;; search for a file called "CRACKME3.KEY"
  48.      :00401032 83F8FF                  cmp eax, FFFFFFFF ;; if file does exist
  49.      :00401035 750C                    jne 00401043      ;; jump
  50.  
  51.      --- snip ---  ;; else show "Uncracked" message
  52.  
  53.      :00401052 6A00                    push 00000000
  54.      :00401054 68A0214000              push 004021A0
  55.      :00401059 50                      push eax
  56.      :0040105A 53                      push ebx
  57.      :0040105B FF35F5204000            push dword ptr [004020F5]
  58.  
  59.      * Reference To: KERNEL32.ReadFile, Ord:0000h
  60.                                        |
  61.      :00401061 E830040000              Call 00401496 ;; start reading from file
  62.      :00401066 833DA021400012          cmp dword ptr [004021A0], 00000012 ;; size = 12h bytes?
  63.      :0040106D 75C8                    jne 00401037  ;; if not, then jump to "Uncracked"
  64.      :0040106F 6808204000              push 00402008 ;; save contents of file
  65.      :00401074 E898020000              call 00401311 ;; calculate a value
  66.      :00401079 8135F920400078563412    xor dword ptr [004020F9], 12345678 ;; XOR it with 12345678
  67.      :00401083 83C404                  add esp, 00000004
  68.      :00401086 6808204000              push 00402008
  69.      :0040108B E8AC020000              call 0040133C
  70.      :00401090 83C404                  add esp, 00000004
  71.      :00401093 3B05F9204000            cmp eax, dword ptr [004020F9] ;; compare two values
  72.      :00401099 0F94C0                  sete al  ;; if same, then set flag
  73.      :0040109C 50                      push eax ;; save eax
  74.      :0040109D 84C0                    test al, al  ;; flag set?
  75.      :0040109F 7496                    je 00401037 ;; if not, then jump
  76.      
  77.      Don't wonder where I got this information. I found all this out during my cracking approach.
  78.      Later you will get it, too.
  79.      OK, create a file CrackMe3.key with a size of 18 bytes. I just wrote 666999666999666999 in
  80.      a plain text file. Then let's have a look at the call at :00401311 which is taken when the
  81.      file has the correct size.
  82.  
  83.      * Referenced by a CALL at Address:
  84.      |:00401074   
  85.      |
  86.      :00401311 33C9                    xor ecx, ecx  ;; erase ecx
  87.      :00401313 33C0                    xor eax, eax  ;; erase eax
  88.      :00401315 8B742404                mov esi, dword ptr [esp+04]  ;; esi = contents of file
  89.      :00401319 B341                    mov bl, 41 ;; bl =41h
  90.  
  91.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  92.      |:00401333(C)
  93.      |
  94.      :0040131B 8A06                    mov al, byte ptr [esi]  ;; al = 1st byte letter of file
  95.      :0040131D 32C3                    xor al, bl              ;; XOR 1st byte with 41h
  96.      :0040131F 8806                    mov byte ptr [esi], al  ;; replace 1st byte with XORed v.
  97.      :00401321 46                      inc esi                 ;; point to next byte
  98.      :00401322 FEC3                    inc bl                  ;; bl = bl + 1
  99.      :00401324 0105F9204000            add dword ptr [004020F9], eax ;; add XORed value
  100.      :0040132A 3C00                    cmp al, 00              ;; still bytes to go ?
  101.      :0040132C 7407                    je 00401335             ;; if not, then jump
  102.      :0040132E FEC1                    inc cl                  ;; cl = cl + 1
  103.      :00401330 80FB4F                  cmp bl, 4F              ;; bl = 4F?
  104.      :00401333 75E6                    jne 0040131B            ;; if bl < 4F, then loop
  105.  
  106.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  107.      |:0040132C(C)
  108.      |
  109.      :00401335 890D49214000            mov dword ptr [00402149], ecx ;; save ecx
  110.      :0040133B C3                      ret  ;; return from call
  111.  
  112.      This passage does nothing but XORing the first 14 bytes of your file with 41 for the first
  113.      byte to 4F for the last byte and adds all these XORed values. For 666999666999666999 this 
  114.      would be:
  115.  
  116.      36 XOR 41 + 
  117.      36 XOR 42 + 
  118.      36 XOR 43 + 
  119.      39 XOR 44 + 
  120.      39 XOR 45 + 
  121.      39 XOR 46 + 
  122.      36 XOR 47 + 
  123.      36 XOR 48 + 
  124.      36 XOR 49 + 
  125.      39 XOR 4A + 
  126.      39 XOR 4B + 
  127.      39 XOR 4C + 
  128.      36 XOR 4D + 
  129.      36 XOR 4E + 
  130.      36 XOR 4F 
  131.      = 693h
  132.  
  133.      This value is XORed with 12345678h at :00401079 when we leave the Call. This will be: 
  134.      EB503412. This value is compared to the last 4 bytes of our keyfile at adress :00401093.
  135.      If they are the same you have cracked it. When you start the CrackMe a messagebox will
  136.      appear saying that you cracked it :) Sadly, your name is not yet displayed in this 
  137.      messagebox, but only some crappy characters. The first 14 bytes that are not needed for
  138.      the validation check of the keyfile are reserved for the name. You know that these 14 bytes
  139.      are decrypted before they are displayed. So we have to save them encrypted in the keyfile.
  140.      We do it in this way for the name LaZaRuS.
  141.  
  142.      L = 4Ch XOR 41h = 0D
  143.      a = 61h XOR 42h = 23
  144.      Z = 5Ah XOR 43h = 19
  145.      a = 61h XOR 44h = 25
  146.      R = 52h XOR 45h = 17
  147.      u = 75h XOR 46h = 33
  148.      S = 53h XOR 47h = 14
  149.  
  150.      These are the bytes you have to enter in the keyfile at the beginning. I added 
  151.      00000000000000h to fill the space. Next time I started it, I saw nothing. Shit, the last 
  152.      four bytes must have another value, now. So breakpoint on :00401093 and F7523412 was the   
  153.      next value. When I started now, I saw: "Cracked by LaZaRuSHIJKLMN!" - Now we know that the 
  154.      00 we entered were (obviously) wrong and the correct keyfile looks like this:
  155.  
  156.      0D23 1925 1733 1448 494A 4B4C 4D4E F752 3412
  157.  
  158.      btw: If you don't know how I came to the values 48494A4B4C4D4E, know a value XORed with
  159.           itself is *always* 0. H XOR H = 0 / 48 XOR 48 = 0 (Hope you got it now)
  160.  
  161.      Actually this is not quiet the correct keyfile. We have to recalculate the last four bytes
  162.      again. But this should be no problem.
  163.  
  164.      0D23 1925 1733 1448 494A 4B4C 4D4E FA54 3412 is the correct keyfile that will show the
  165.      "Cracked by LaZaRuS!" message. (note: These are hex-values, no ASCII values; in ASCII it
  166.      looks like this: #%3HIJKLMN·T4).
  167.  
  168.  
  169. I.  BTW
  170.      
  171.      Greets to: tKC, Ed!son, Moral Insanity, +Sandman, Fravia+ and everyone at #cracking4newbies,
  172.      +Sandman's forum and Fravia+'s forum.
  173.  
  174. VII. All tutorials by LaZaRuS
  175.       
  176.